home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_bab_exterior_grid.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  323 lines

  1. # Jones 3D Cog Script
  2. #
  3. # BAB_Commie_Grid.cog
  4. # [JM]
  5. #
  6. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  7. #
  8. # ========================================================================================
  9.  
  10. symbols
  11.  
  12.  
  13. message         startup
  14. message         entered
  15. message         crossed
  16. message         killed 
  17. message         damaged
  18.  
  19. # ========================================================================================
  20.  
  21. flex            MakeGrid        local
  22. flex            EnableAI        local
  23. flex            DisableAI       local
  24. flex            Blind           local
  25. flex            Unblind         local
  26.  
  27. # =============================== WORLD REFERENCES ==========================
  28.  
  29. sector          EnableGrid00    LinkID=1
  30. sector          EnableGrid01    LinkID=1
  31.  
  32. surface         EnableGrid02    LinkID=1
  33. surface         EnableGrid03    LinkID=1
  34.  
  35. surface         DisableGrid00   LinkID=2
  36. surface         DisableGrid01   LinkID=2        
  37.  
  38. surface         Blind00         LinkID=3
  39. surface         Blind01         LinkID=3
  40.  
  41. surface         UnBlind00       LinkID=4
  42. surface         UnBlind01       LinkID=4
  43. surface         UnBlind02       LinkID=4
  44. surface         UnBlind03       LinkID=4
  45. surface         UnBlind04       LinkID=4
  46. surface         UnBlind04       LinkID=4
  47. surface         UnBlind05       LinkID=4
  48.  
  49. # =============================== MISC LOCAL VARIABLES ======================
  50.  
  51. int             counter         local
  52. int             GridOn=0        local      # 1 == on, 0 == off
  53.  
  54. int             Blinded=0       local
  55.  
  56. int             HasBeenDamaged=0    local
  57.                                           
  58. # =============================== CONSTANTS ==============================
  59.  
  60. int             CLEAR_WAYPOINTS=60          local
  61. int             NUMBER_OF_WAYPOINTS=28      local
  62. int             NUMBER_OF_COMMIES=5         local
  63.  
  64. # ================================== COMMIES =================================
  65.  
  66. thing           TempCommie      local
  67.  
  68. thing           Commie00        mask=0x448  
  69. thing           Commie01        mask=0x448  
  70. thing           Commie02        mask=0x448  
  71. thing           Commie03        mask=0x448  
  72. thing           Commie04        mask=0x448  
  73. #thing           Commie05        mask=0x448
  74. #thing           Commie06        mask=0x448
  75.  
  76. # ============================== WAYPOINTS - GHOST OBJECTS ===============
  77.  
  78. thing           TempWpnt
  79.  
  80. thing           wpnt00
  81. thing           wpnt01
  82. thing           wpnt02
  83. thing           wpnt03
  84. thing           wpnt04
  85. thing           wpnt05
  86. thing           wpnt06
  87. thing           wpnt07
  88. thing           wpnt08
  89. thing           wpnt09
  90. thing           wpnt10
  91. thing           wpnt11
  92. thing           wpnt12
  93. thing           wpnt13
  94. thing           wpnt14
  95. thing           wpnt15
  96. thing           wpnt16
  97. thing           wpnt17
  98. thing           wpnt18
  99. thing           wpnt19
  100. thing           wpnt20
  101. thing           wpnt21
  102. thing           wpnt22
  103. thing           wpnt23
  104. thing           wpnt24
  105. thing           wpnt25
  106. thing           wpnt26
  107. thing           wpnt27
  108.  
  109. # ======================================================================
  110. end
  111. # ======================================================================
  112. # ============================ CODE ====================================
  113. # ======================================================================
  114. code
  115. # ======================================================================
  116. startup:
  117.  
  118.     Call Blind;
  119.     
  120.     return;
  121.  
  122. # ======================================================================
  123. entered:
  124.     
  125.     if(GetsenderID() == 1 && GridOn == 0)   
  126.      {
  127.         GridOn = 1;
  128.         Call MakeGrid;
  129.         Call EnableAI;
  130.     }
  131.     
  132.     if(GetSenderID() == 4)
  133.     {
  134.         Call Unblind;
  135.     }
  136.     
  137.     return;
  138.     
  139. # ======================================================================
  140. crossed:
  141.     
  142.     if(GetSenderID() == 1 && GridOn == 0)
  143.     {
  144.         GridOn = 1;
  145.         Call MakeGrid;
  146.         Call EnableAI;           
  147.     }
  148.  
  149.     else if(GetSenderID() == 2 && GridOn == 1)
  150.     {
  151.         GridOn = 0;
  152.         Call DisableAI;
  153.     }
  154.     
  155.     else if(GetSenderID() == 3)
  156.     {
  157.         Call Blind;
  158.     }
  159.     
  160.     else if(GetSenderID() == 4)
  161.     {
  162.         Call UnBlind;
  163.     }
  164.     
  165.     return;
  166.  
  167. # ======================================================================
  168. killed:
  169.     
  170.     TempCommie = GetSenderRef();
  171.     
  172.     for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1)
  173.     {
  174.         if(Commie00[counter] == TempCommie) Commie00[counter] = -1;
  175.     }           
  176.  
  177.     return;
  178.     
  179. # ======================================================================
  180. damaged:
  181.  
  182.     if(HasBeenDamaged == 1) return;
  183.         
  184.     if(Blinded == 1) Call Unblind;
  185.     
  186.     HasBeenDamaged = 1;
  187.     
  188.     for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1)
  189.     {
  190.         if(Commie00[counter] != -1)
  191.         {
  192.             if(RandBetween(0, 2) == 2)
  193.             {
  194.                 AIWpntHuntTarget(Commie00[counter], 1.6, 0.0);
  195.             }
  196.             else if(RandBetween(0, 2) <= 2)
  197.             {
  198.                 AIEnableInstinct(Commie00[counter], "roam", 1);
  199.             }
  200.         }
  201.     }
  202.     
  203.  
  204.     return;
  205.  
  206. # =============================== SUBROUTINES ==========================
  207. EnableAI:
  208.  
  209.     for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1)
  210.     {
  211.         if(Commie00[counter] != -1)
  212.         {
  213.             AISetInstinctWpntMode(Commie00[counter]);
  214.         }
  215.     }
  216.     
  217.     return;
  218.     
  219. # ======================================================================    
  220. DisableAI:
  221.  
  222.     for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1)
  223.     {
  224.         if(Commie00[counter] != -1)
  225.         {
  226.             AIClearInstinctWpntMode(Commie00[counter]);
  227.         }
  228.     }
  229.     
  230.     return;
  231.     
  232. # ======================================================================    
  233. MakeGrid:
  234.  
  235.     for(counter = 0; counter < CLEAR_WAYPOINTS; counter = counter + 1)
  236.     {
  237.         //For loop to clear any pre-existing waypoints
  238.         AISetWpnt(TempWpnt, counter);
  239.     }
  240.  
  241.     for(counter = 0; counter < NUMBER_OF_WAYPOINTS; counter = counter + 1)
  242.     {
  243.         AISetWpnt(Wpnt00[counter], counter);
  244.     }
  245.     
  246.     AIConnectWpnts(0, 1);
  247.     AIConnectWpnts(1, 2);
  248.     AIConnectWpnts(2, 3);
  249.     AIConnectWpnts(3, 4);
  250.     AIConnectWpnts(4, 5);
  251.     AIConnectWpnts(5, 6);
  252.     AIConnectWpnts(6, 7);
  253.     AIConnectWpnts(7, 8);
  254.     //AIConnectWpnts(8, 9);
  255.     AIConnectWpnts(8, 14);
  256.     //AIConnectWpnts(9, 10);
  257.     //AIConnectWpnts(10, 11);
  258.     //AIConnectWpnts(10, 12);
  259.     //AIConnectWpnts(12, 13);
  260.     AIConnectWpnts(14, 15);
  261.     AIConnectWpnts(15, 16);
  262.     AIConnectWpnts(16, 17);
  263.     AIConnectWpnts(16, 20);
  264.     AIConnectWpnts(17, 20);
  265.     AIConnectWpnts(18, 21);
  266.     AIConnectWpnts(18, 22);
  267.     AIConnectWpnts(19, 22);
  268.     AIConnectWpnts(19, 23);
  269.     AIConnectWpnts(20, 21);
  270.     AIConnectWpnts(20, 27);
  271.     AIConnectWpnts(21, 27);
  272.     AIConnectWpnts(21, 23);
  273.     AIConnectWpnts(22, 24);
  274.     AIConnectWpnts(24, 25);
  275.     AIConnectWpnts(25, 26);
  276.     AIConnectWpnts(26, 27);
  277.     
  278.     return;
  279.  
  280. # ======================================================================    
  281. Blind:
  282.     
  283.     if(Blinded == 1) return;
  284.     
  285.     if(HasBeenDamaged == 1) return;
  286.     
  287.     for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1)
  288.     {
  289.         if(Commie00[counter] != -1)
  290.         {
  291.             SetActorFlags(Commie00[counter], 0x800);    //Blind
  292.             SetActorFlags(Commie00[counter], 0x400);    //Deaf
  293.         }
  294.     }
  295.     
  296.     Blinded = 1;
  297.  
  298.     return;
  299.  
  300. # ======================================================================    
  301. UnBlind:
  302.  
  303.     if(Blinded == 0) return;
  304.     
  305.     for(counter = 0; counter < NUMBER_OF_COMMIES; counter = counter + 1)
  306.     {
  307.         if(Commie00[counter] != -1)
  308.         {
  309.             ClearActorFlags(Commie00[counter], 0x800);
  310.             ClearActorFlags(Commie00[counter], 0x400);
  311.         }
  312.     }
  313.     
  314.     Blinded = 0;
  315.     
  316.     return;
  317.     
  318. # ======================================================================    
  319. end
  320.  
  321.  
  322.